Skip to content

Add buildCp tests #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2025
Merged

Conversation

roger2hk
Copy link
Contributor

Towards #103.

@roger2hk roger2hk requested a review from phbnf March 17, 2025 22:00
@phbnf
Copy link
Collaborator

phbnf commented Mar 18, 2025

This PR is exporting some structs that are private in order to call tls.Unmarshall, which I'm goin to delete in the next PR because crypto/tls does not have an Unmarshall method. Let's wait a bit before we submit this PR?

@roger2hk roger2hk force-pushed the add-build-cp-test branch from d832cbf to 15b2c33 Compare April 14, 2025 08:59
@roger2hk roger2hk force-pushed the add-build-cp-test branch from 15b2c33 to 820591d Compare April 14, 2025 09:03
@roger2hk roger2hk requested a review from phbnf April 14, 2025 09:06
type rfc6962NoteSignature struct {
timestamp uint64
signature rfc6962.DigitallySigned
type RFC6962NoteSignature struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the struct itself doesn't need to be exported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexported the struct.

Here is the test failure log if the field is unexported.

--- FAIL: TestBuildCp (0.00s)
panic: reflect: reflect.Value.SetUint using value obtained using unexported field [recovered]
        panic: reflect: reflect.Value.SetUint using value obtained using unexported field

goroutine 384 [running]:
testing.tRunner.func1.2({0x96f660, 0xc000041b50})
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1734 +0x21c
testing.tRunner.func1()
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1737 +0x35e
panic({0x96f660?, 0xc000041b50?})
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:787 +0x132
reflect.flag.mustBeAssignableSlow(0xaf1b24eac618794b?)
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/reflect/value.go:254 +0xb4
reflect.flag.mustBeAssignable(...)
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/reflect/value.go:244
reflect.Value.SetUint({0x96f860?, 0xc0003f9350?, 0x9eab60?}, 0x15e5c442378)
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/reflect/value.go:2181 +0x45
github.com/transparency-dev/static-ct/internal/types/tls.parseField({0x96f860?, 0xc0003f9350?, 0x930495?}, {0xc0004dc700, 0x74, 0x80}, 0x0, 0xc00052c640)
        /usr/local/google/home/rogerng/Git/static-ct/internal/types/tls/tls.go:357 +0x838
github.com/transparency-dev/static-ct/internal/types/tls.parseField({0x9d8700?, 0xc0003f9350?, 0x0?}, {0xc0004dc700, 0x74, 0x80}, 0x0, 0x0)
        /usr/local/google/home/rogerng/Git/static-ct/internal/types/tls/tls.go:435 +0x184b
github.com/transparency-dev/static-ct/internal/types/tls.UnmarshalWithParams({0xc0004dc700, 0x74, 0x80}, {0x959280, 0xc0003f9350}, {0x0?, 0x1?})
        /usr/local/google/home/rogerng/Git/static-ct/internal/types/tls/tls.go:162 +0xe5
github.com/transparency-dev/static-ct/internal/types/tls.Unmarshal(...)
        /usr/local/google/home/rogerng/Git/static-ct/internal/types/tls/tls.go:148
github.com/transparency-dev/static-ct/internal/scti.TestBuildCp(0xc0005896c0)
        /usr/local/google/home/rogerng/Git/static-ct/internal/scti/signatures_test.go:430 +0x1b0
testing.tRunner(0xc0005896c0, 0xa7c3f0)
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1792 +0xf4
created by testing.(*T).Run in goroutine 1
        /usr/local/google/home/rogerng/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1851 +0x413

@phbnf
Copy link
Collaborator

phbnf commented Apr 14, 2025

Just for the record: I ended up copying over some of c-t-go TLS package in https://github.com/transparency-dev/static-ct/pull/202/files. When we have time, think we can use something a bit neater and simpler, but it works for now, and has been for years.

@roger2hk roger2hk merged commit c6184db into transparency-dev:main Apr 14, 2025
7 checks passed
@roger2hk roger2hk deleted the add-build-cp-test branch April 14, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants